#!/bin/sh
CWD=$(pwd)
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"

# PHP_VERSION=5.6
PHP_VERSION=7.3

PHP_CONFIG=php-config$PHP_VERSION

phpize$PHP_VERSION

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --with-php-config=$PHP_CONFIG

make
make cli
make install-all
cp $CWD/40-trace.ini /etc/php/$PHP_VERSION/cli/conf.d/

# PKG=/tmp/t
# EXTENSION_DIR="$PKG/$($PHP_CONFIG --extension-dir)"
# mkdir -p $EXTENSION_DIR $PKG/etc/php.d
# make install DESTDIR=$PKG EXTENSION_DIR=$EXTENSION_DIR
